package com.kushe.entity;

import com.kushe.util.core.DbUtils;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.One;
import org.nutz.dao.entity.annotation.Table;

/**
 * Created by WhiteBlue on 15/5/1.
 */

@Table("ks_sort")
public class Sort {

    @Id
    private int id;

    @Column
    private String name;

    @Column
    private int category_id;

    @Column
    private int pv;

    @One(target = Category.class, field = "category_id")
    private Category category;

    public int getId() {
        return id;
    }


    public int getCategory_id() {
        return category_id;
    }

    public void setCategory_id(int category_id) {
        this.category_id = category_id;
    }

    public Category getCategory() {
        if (this.category == null) {
            DbUtils.getNutzDao().fetchLinks(this, "category");
            return this.category;
        } else
            return this.category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPv() {
        return pv;
    }

    public void setPv(int pv) {
        this.pv = pv;
    }
}
